local extension = Package:new("history")
extension.extensionName = "ts"
Fk:loadTranslationTable{
    ["history"] = "TS复刻",
}
local m__xiahoushi = General(extension, "m__xiahoushi", "shu", 3,3,General.FeMale)
local m__yanyu = fk.CreateActiveSkill{
    name = "m__yanyu",
    anim_type = "drawcard",
    can_use = function(self, player)
        return player:usedSkillTimes(self.name) <= 1
    end,
    target_num=0,
    card_num=1,
    card_filter = function(self, to_select, selected)
        return #selected ==0 and Fk:getCardById(to_select).trueName == "slash"
    end,
    target_filter=function(self, to_select, selected, selected_cards, card)
        return #selected < 0
    end,
    on_use = function(self, room, effect)
        local from = room:getPlayerById(effect.from)
        room:throwCard(effect.cards, self.name, from)
        from:drawCards(1)
        room:addPlayerMark(from, "@yanyu", 1)
    end,
}
local m__yanyu_trigger = fk.CreateTriggerSkill{
    name = "#m__yanyu",
    anim_type = "drawcard",
    events = {fk.EventPhaseStart},
    can_trigger = function(self, event, target, player, data)
        return target == player and player:hasSkill(self.name)
                and player.phase == Player.Discard
                and player:getMark("@yanyu")>0
    end,
    on_cost = function(self, event, target, player, data)
        local room=player.room
        if room:askForSkillInvoke(player, self.name, data) then
            local others = room:getOtherPlayers(player)
            local targets = {}
            for _, p in ipairs(others) do
                table.insert(targets, p.id)
            end
            local result=room:askForChoosePlayers(player,targets,1,1,"请选择要摸牌的人",self.name)
            if #result>0 then
                self.other = result
                return true
            end
        end
        room:removePlayerMark(player, "@yanyu", player:getMark("@yanyu"))
    end,
    on_use = function(self, event, target, player, data)
        local room=player.room
        local other=room:getPlayerById(self.other[1])
        if player:getMark("@yanyu")==1 then
            other:drawCards(3)
            room:removePlayerMark(player, "@yanyu", 1)
        else
            other:drawCards(6)
            room:removePlayerMark(player, "@yanyu", 2)
        end
    end,
}
local m__qiaoshi = fk.CreateTriggerSkill{
    name = "m__qiaoshi",
    anim_type = "masochism",
    events = {fk.Damaged},
    can_trigger = function(self, event, target, player, data)
        local from = data.from
        if from==player then
            return false
        end
        return from ~= nil and
                target == player and
                target:hasSkill(self.name) and
                (not from:isNude()) and
                not target.dead and
                player:usedSkillTimes(self.name) == 0
    end,
    on_cost = function(self, event, target, player, data)
        local room = player.room
        local from = data.from
        if room:askForSkillInvoke(from, self.name, data) then
            return true
        end
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local from = data.from
        from:drawCards(2)
        room:recover({
            who = player,
            num = data.damage,
            recoverBy = from,
            skillName = self.name
        })
    end,
}
m__yanyu:addRelatedSkill(m__yanyu_trigger)
m__xiahoushi:addSkill(m__yanyu)
m__xiahoushi:addSkill(m__qiaoshi)
Fk:loadTranslationTable{
    ["m__xiahoushi"] = "谋夏侯氏",
    ["m__yanyu"]="燕语",
    ["@yanyu"]="燕语",
    ["#m__yanyu"]="燕语",
    [":m__yanyu"]="出牌阶段限两次。你可以弃置1张【杀】并摸1张牌。出牌阶段结束时，你可令一名其他角色摸X张牌。（X为你本回合以此法弃置【杀】数量的三倍）",
    ["m__qiaoshi"]="樵拾",
    [":m__qiaoshi"]="每回合限一次。你受到其他角色造成的伤害后，伤害来源可令你回复等同本次伤害值的体力，然后其摸2张牌。",
    ["$m__yanyu1"]="君纵横沙场，妾随军助威。",
    ["$m__yanyu2"]="莺声燕语，解君心忧。",
    ["$m__qiaoshi1"]="出郡樵采，与君结缘。",
    ["$m__qiaoshi2"]="与君相遇，因缘际会。",
    ["~m__xiahoushi"] = "玄鸟不曾归,君亦不再来",
}
return extension